import { lazy } from 'react'
import { Navigate } from 'react-router-dom'

var Index = lazy(()=>import('../views/Index'))
var Home = lazy(()=>import('../views/Index/Home'))
var Swiper = lazy(()=>import('../views/Index/Swiper'))
var SwiperAdd = lazy(()=>import('../views/Index/SwiperAdd'))
var Admin = lazy(()=>import('../views/Index/Admin'))
var Map = lazy(()=>import('../views/Index/Map'))
var Pro = lazy(()=>import('../views/Index/Pro'))
var Seckill = lazy(()=>import('../views/Index/Seckill'))
var Filter = lazy(()=>import('../views/Index/Filter'))
var Recommend = lazy(()=>import('../views/Index/Recommend'))
var Editor = lazy(()=>import('../views/Index/Editor'))
var Excel = lazy(()=>import('../views/Index/Excel'))
var Echarts = lazy(()=>import('../views/Index/Echarts'))

var Login = lazy(()=>import('../views/Login'))
var NotFound = lazy(()=>import('../views/NotFound'))

//配置路由表
export default [
    {
        path:'/index',
        element: <Index />,
        children:[
            {
                path:'/index/home',
                element: <Home />,
            },
            {
                path:'/index/swiper',
                element: <Swiper />,
            },
            {
                path:'/index/swiperadd',
                element: <SwiperAdd />,
            },
            {
                path:'/index/admin',
                element: <Admin />,
            },
            {
                path:'/index/pro',
                element: <Pro />,
            },
            {
                path:'/index/filter',
                element: <Filter />,
            },
            {
                path:'/index/seckill',
                element: <Seckill />,
            },
            {
                path:'/index/recommend',
                element: <Recommend />,
            },
            {
                path:'/index/echarts',
                element: <Echarts />,
            },
            {
                path:'/index/editor',
                element: <Editor />,
            },
            {
                path:'/index/excel',
                element: <Excel />,
            },
            {
                path:'/index/map',
                element: <Map />,
            },
            {
                path:'/index',
                element: <Navigate to="/index/home" />,
            },
            {
                path:'*',
                element: <NotFound />,
            },
        ]
    },
    {
        path:'/login',
        element: <Login />
    },
    {
        path:'/',
        element: <Navigate to="/index" />
    },
    {
        path:'*',
        element: <NotFound />
    },
]